<template>
	<view class="class-list">
		<view class="class" >
			<view class="class-text" @click="toStudent(item.id,item.className)"  v-for="item in classList">
				<p>{{item.className}}</p>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				classList:[],
				teacherId:null,
			}
		},
		onLoad(e) {
			this.teacherId = e.teacherId
			this.getClassList()
			uni.$on('editClass',() => {
					this.getClassList()
				})
			
		},
		methods: {
			//点击跳转班级学生
			toStudent(id,className){
				uni.$common.navigateTo("/subpkg/teacher/teacher-student/teacher-student?classId="+id+"&className="+className)
			
			},
			getClassList(){
				uni.$api.findClassListByTeacherId(this.teacherId).then(result =>{
					this.classList = result
				})
			}
		}
	}
</script>

<style>
.class{
	width: 90%;
	margin-top: 20px;
	margin-left: 20px;
	
}
.class-text{
	width: 45%;
	height: 80px;
	/* background: url("/static/me/背景.jpg") no-repeat; */
/* 	background-size: 100%; */
	background-color: #F7CC60;
	display: inline-block;
	margin-left: 15rpx;
	margin-right: 20rpx;
	margin-bottom: 30rpx;
	border-radius: 10rpx;
	text-align: left;
	padding-left: 30rpx;
}
.class-text p{
	line-height: 100rpx;
	color: #804215;
}
</style>
